{% extends "base.html" %}
{% block content %}
<div class="row">
  <div class="span12">
    <ul class="messages">
      {% for item in messages %}
      <li>
        <time>{{item.timestamp|date:"yyyy-MM-dd HH:mm"}}</time>
        <p>{{item.message}}</p>
        <p> - {{item.name}}</p>
      </li>
      {% endfor %}
    </ul>
  </div>
</div>
<div class="row">
  <div class="span12">
    <form method="POST" action="/">
      {% csrf-field %}
      <p>
        Name:
        <input class="form-control"
               type="text"
               name="name"
               value="{{name}}" />
      </p>
      {% if errors.name %}
      <div class="alert alert-danger">{{errors.name|join}}</div>
      {% endif %}
      <p>
        Message:
                <textarea class="form-control"
                          rows="4"
                          cols="50"
                          name="message">{{message}}</textarea>
      </p>
      {% if errors.message %}
      <div class="alert alert-danger">{{errors.message|join}}</div>
      {% endif %}
      <input type="submit" class="btn btn-primary" value="comment" />
    </form>
  </div>
</div>
{% endblock %}